const { Tab } = require('../../assets/libs/zanui/index');

var app = getApp();
Page(Object.assign({}, Tab, {
  data: {
		riderStartSetting:{
		  'riderStartDuration': "",
		  'riderStartImage': "",
			'riderIsStart': true,
		},
		cdnUrl: '',
	
		/* 自定义导航栏参数 */
		loading: false,
		color: '#FFFFFF',
		background: '#FFFFFF',
		show: true,
		animated: false,
		back: false,
		title: "",
  },
  onLoad: function () {
    var that = this;
    console.log(app),
		that.setData({
			cdnUrl: app.cdnUrl,
      height: app.globalData.windowHeight*2,
      width: app.globalData.windowWidth*2,
		});
    app.request('/api/timetable.index/index', {}, function (data, ret) {
      that.setData({
				riderStartSetting: data.riderStartSetting
      });
			if( data.riderStartSetting.riderIsStart==true ){
				setTimeout(function() {
					wx.switchTab({
						url:"/page/index/index"
					});
				}, data.riderStartSetting.riderStartDuration);
			}else{
        wx.switchTab({
        	url:"/page/index/index"
        });
      }
    }, function (data, ret) {
      app.error(ret.msg);
    });
  },
  onShareAppMessage: function () {
    return {
      title: '',
      desc: '',
      path: '/page/index/index'
    };
  }
}));
